package com.apes.framework.plugin.event;

import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;

/**
 * 功能：事件对象
 *
 * @author xul
 * @create 2018-02-02 11:18
 */
public class ApesEvent extends EventObject {
    private static final long serialVersionUID = -7593225595321267119L;

    private String topic;  //消息主题
    private boolean isSynchronized = true; //消息类型：（同步：true），（异步：false）
    private Object body; //消息
    private List results = new ArrayList(); //返回结果集

    public ApesEvent(Object source, String topic, Object body) {
        super(source);
        this.topic = topic;
        this.body = body;
    }

    public ApesEvent(Object source, String topic, boolean isSynchronized, Object body) {
        super(source);
        this.topic = topic;
        this.isSynchronized = isSynchronized;
        this.body = body;
    }

    public String getTopic() {
        return topic;
    }

    public boolean isSynchronized() {
        return isSynchronized;
    }

    public Object getBody() {
        return body;
    }

    public List getResults() {
        return results;
    }

    public void setResult(Object result) {
        results.add(result);
    }
}
